/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-06-07 13:57:02
 * @LastEditTime : 2023-06-08 17:12:04
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\GantryCrane.jsx
 * @Description  :
 */

import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton, OpenTwoRouter } from '../Common/options'

export const GantryCrane = async ({ url, OptionsEvent, ClientData, Permission }) => {
    let data = {
        type: '梁场管理',
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission.findIndex(v => v.uuid === '0549fb5d-b55d-4a05-83f5-03f7a040926a') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />
            ),
        ],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.tableName, title: '类别名称', rules: true },
            { ...commonTableList.code, rules: true },
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization, rules: true },
            {
                ...commonTableList.systemOperation,
                width: 200,
                render: (_, record) => {
                    return [
                        <OpenTwoRouter
                            key="detail"
                            title="数据明细"
                            modal="TableList"
                            OptionsEvent={OptionsEvent}
                            other={{
                                page: 'GantryCrane',
                                Permission,
                                oneData: record,
                                header: data.columns,
                            }}
                        />,
                        Permission.findIndex(v => v.uuid === '476e35c1-c124-43f7-a72b-2f3d342912d3') !== -1 && (
                            <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />
                        ),
                        Permission.findIndex(v => v.uuid === '6a0a9edb-88cf-474a-bfa6-ea7e808fff86') !== -1 && (
                            <OpenTwoRouter
                                key="TwoOne"
                                title="摄像头列表"
                                modal="TableList"
                                OptionsEvent={OptionsEvent}
                                other={{
                                    page: 'GantryCraneCameras',
                                    Permission,
                                    oneData: record,
                                    header: data.columns,
                                }}
                            />
                        ),
                        Permission.findIndex(v => v.uuid === '2e198b95-9e51-4091-9cfb-e7abebee69a8') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }

    return data
}
